/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('sysom', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AuthDiagnosisRequest {
  autoCreateRole?: boolean(name='autoCreateRole'),
  autoInstallAgent?: boolean(name='autoInstallAgent'),
  instances?: [ 
    {
      instance?: string(name='instance'),
      region?: string(name='region'),
    }
  ](name='instances'),
}

model AuthDiagnosisResponseBody = {
  code?: string(name='code', example='Success'),
  data?: any(name='data', example='{}'),
  message?: string(name='message', example='SysomOpenAPIAssumeRoleException: EntityNotExist.Role The role not exists: acs:ram::xxxxx:role/aliyunserviceroleforsysom'),
  requestId?: string(name='request_id'),
}

model AuthDiagnosisResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AuthDiagnosisResponseBody(name='body'),
}

/**
 * @summary 授权 SysOM 对某个机器进行诊断
 *
 * @param request AuthDiagnosisRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return AuthDiagnosisResponse
 */
async function authDiagnosisWithOptions(request: AuthDiagnosisRequest, headers: map[string]string, runtime: Util.RuntimeOptions): AuthDiagnosisResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.autoCreateRole)) {
    body['autoCreateRole'] = request.autoCreateRole;
  }
  if (!Util.isUnset(request.autoInstallAgent)) {
    body['autoInstallAgent'] = request.autoInstallAgent;
  }
  if (!Util.isUnset(request.instances)) {
    body['instances'] = request.instances;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AuthDiagnosis',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/diagnosis/auth`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 授权 SysOM 对某个机器进行诊断
 *
 * @param request AuthDiagnosisRequest
 * @return AuthDiagnosisResponse
 */
async function authDiagnosis(request: AuthDiagnosisRequest): AuthDiagnosisResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return authDiagnosisWithOptions(request, headers, runtime);
}

model GenerateCopilotResponseRequest {
  llmParamString?: string(name='llmParamString'),
}

model GenerateCopilotResponseResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: string(name='data'),
  massage?: string(name='massage', example='Requests for llm service failed'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model GenerateCopilotResponseResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GenerateCopilotResponseResponseBody(name='body'),
}

/**
 * @summary 获取copilot服务的返回结果
 *
 * @param request GenerateCopilotResponseRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GenerateCopilotResponseResponse
 */
async function generateCopilotResponseWithOptions(request: GenerateCopilotResponseRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GenerateCopilotResponseResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.llmParamString)) {
    body['llmParamString'] = request.llmParamString;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GenerateCopilotResponse',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/copilot/generate_copilot_response`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取copilot服务的返回结果
 *
 * @param request GenerateCopilotResponseRequest
 * @return GenerateCopilotResponseResponse
 */
async function generateCopilotResponse(request: GenerateCopilotResponseRequest): GenerateCopilotResponseResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return generateCopilotResponseWithOptions(request, headers, runtime);
}

model GenerateCopilotStreamResponseRequest {
  llmParamString?: string(name='llmParamString'),
}

model GenerateCopilotStreamResponseResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: string(name='data'),
  message?: string(name='message', example='Requests for llm service failed'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model GenerateCopilotStreamResponseResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GenerateCopilotStreamResponseResponseBody(name='body'),
}

/**
 * @summary 流式copilot服务接口
 *
 * @param request GenerateCopilotStreamResponseRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GenerateCopilotStreamResponseResponse
 */
async function generateCopilotStreamResponseWithOptions(request: GenerateCopilotStreamResponseRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GenerateCopilotStreamResponseResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.llmParamString)) {
    body['llmParamString'] = request.llmParamString;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GenerateCopilotStreamResponse',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/copilot/generate_copilot_stream_response`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 流式copilot服务接口
 *
 * @param request GenerateCopilotStreamResponseRequest
 * @return GenerateCopilotStreamResponseResponse
 */
async function generateCopilotStreamResponse(request: GenerateCopilotStreamResponseRequest): GenerateCopilotStreamResponseResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return generateCopilotStreamResponseWithOptions(request, headers, runtime);
}

model GetAIQueryResultRequest {
  analysisId?: string(name='analysisId', example='16896fa8-37f6-4c70-bb32-67fa9817d426'),
}

model GetAIQueryResultResponseBody = {
  code?: string(name='code', example='Success'),
  data?: string(name='data', example='{\\\\"task_id\\\\": \\\\"y4ba8uRV\\\\"}'),
  message?: string(name='message'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model GetAIQueryResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAIQueryResultResponseBody(name='body'),
}

/**
 * @summary 查看AI Infra分析结果
 *
 * @param request GetAIQueryResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAIQueryResultResponse
 */
async function getAIQueryResultWithOptions(request: GetAIQueryResultRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetAIQueryResultResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.analysisId)) {
    body['analysisId'] = request.analysisId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetAIQueryResult',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/app_observ/aiAnalysis/query_result`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 查看AI Infra分析结果
 *
 * @param request GetAIQueryResultRequest
 * @return GetAIQueryResultResponse
 */
async function getAIQueryResult(request: GetAIQueryResultRequest): GetAIQueryResultResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getAIQueryResultWithOptions(request, headers, runtime);
}

model GetAbnormalEventsCountRequest {
  cluster?: string(name='cluster', example='1808078950770264'),
  end?: float(name='end', example='1725801327754'),
  instance?: string(name='instance', description='This parameter is required.', example='i-wz9d00ut2ska3mlyhn6j'),
  namespace?: string(name='namespace', example='default'),
  pod?: string(name='pod', example='test-pod'),
  showPod?: int32(name='showPod'),
  start?: float(name='start', example='1725797727754'),
}

model GetAbnormalEventsCountResponseBody = {
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      type?: string(name='type', example='health'),
      value?: long(name='value', example='1'),
    }
  ](name='data'),
  message?: string(name='message', example='result: code=1 msg=(Request failed, status_code != 200)'),
}

model GetAbnormalEventsCountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAbnormalEventsCountResponseBody(name='body'),
}

/**
 * @summary 获取节点/Pod不同等级异常事件的数量
 *
 * @param request GetAbnormalEventsCountRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAbnormalEventsCountResponse
 */
async function getAbnormalEventsCountWithOptions(request: GetAbnormalEventsCountRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetAbnormalEventsCountResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cluster)) {
    query['cluster'] = request.cluster;
  }
  if (!Util.isUnset(request.end)) {
    query['end'] = request.end;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.namespace)) {
    query['namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.pod)) {
    query['pod'] = request.pod;
  }
  if (!Util.isUnset(request.showPod)) {
    query['showPod'] = request.showPod;
  }
  if (!Util.isUnset(request.start)) {
    query['start'] = request.start;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAbnormalEventsCount',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/range/abnormaly_events_count`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取节点/Pod不同等级异常事件的数量
 *
 * @param request GetAbnormalEventsCountRequest
 * @return GetAbnormalEventsCountResponse
 */
async function getAbnormalEventsCount(request: GetAbnormalEventsCountRequest): GetAbnormalEventsCountResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getAbnormalEventsCountWithOptions(request, headers, runtime);
}

model GetAgentRequest {
  agentId?: string(name='agent_id'),
}

model GetAgentResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: {
    createdAt?: string(name='created_at'),
    description?: string(name='description'),
    id?: string(name='id'),
    name?: string(name='name'),
    supportArch?: string(name='support_arch'),
    type?: string(name='type'),
    updatedAt?: string(name='updated_at'),
    versions?: [ 
      {
        createdAt?: string(name='created_at'),
        installScript?: string(name='install_script'),
        uninstallScript?: string(name='uninstall_script'),
        updatedAt?: string(name='updated_at'),
        upgradeScript?: string(name='upgrade_script'),
        version?: string(name='version'),
      }
    ](name='versions'),
  }(name='data'),
  message?: string(name='message', example='SysomOpenAPIException: SysomOpenAPI.InvalidParameter Invalid params, should be json string or dict'),
}

model GetAgentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAgentResponseBody(name='body'),
}

/**
 * @summary 获取某个组件的详情
 *
 * @param request GetAgentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAgentResponse
 */
async function getAgentWithOptions(request: GetAgentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetAgentResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.agentId)) {
    query['agent_id'] = request.agentId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAgent',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/get_agent`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取某个组件的详情
 *
 * @param request GetAgentRequest
 * @return GetAgentResponse
 */
async function getAgent(request: GetAgentRequest): GetAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getAgentWithOptions(request, headers, runtime);
}

model GetAgentTaskRequest {
  taskId?: string(name='task_id'),
}

model GetAgentTaskResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: {
    jobs?: [ 
      {
        error?: string(name='error'),
        instance?: string(name='instance'),
        params?: any(name='params'),
        region?: string(name='region'),
        result?: string(name='result'),
        status?: string(name='status', example='Running'),
      }
    ](name='jobs'),
    taskId?: string(name='task_id'),
  }(name='data'),
  message?: string(name='message', example='SysomOpenAPIException: SysomOpenAPI.InvalidParameter Invalid params, should be json string or dict'),
}

model GetAgentTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAgentTaskResponseBody(name='body'),
}

/**
 * @summary 获取Agent安装任务执行状态
 *
 * @param request GetAgentTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAgentTaskResponse
 */
async function getAgentTaskWithOptions(request: GetAgentTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetAgentTaskResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    query['task_id'] = request.taskId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAgentTask',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/get_agent_task`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取Agent安装任务执行状态
 *
 * @param request GetAgentTaskRequest
 * @return GetAgentTaskResponse
 */
async function getAgentTask(request: GetAgentTaskRequest): GetAgentTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getAgentTaskWithOptions(request, headers, runtime);
}

model GetCopilotHistoryRequest {
  count?: long(name='count', description='This parameter is required.', example='100'),
}

model GetCopilotHistoryResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.InvalidParameter'),
  data?: [ 
    {
      content?: string(name='content'),
      time?: string(name='time', example='2024-09-02 10:02:39'),
      user?: string(name='user', example='user
copilot'),
    }
  ](name='data'),
  message?: string(name='message', example='SysomOpenAPIAssumeRoleException: EntityNotExist.Role The role not exists: acs:ram::xxxxx:role/aliyunserviceroleforsysom'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model GetCopilotHistoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCopilotHistoryResponseBody(name='body'),
}

/**
 * @summary 获取copilot历史聊天记录
 *
 * @param request GetCopilotHistoryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetCopilotHistoryResponse
 */
async function getCopilotHistoryWithOptions(request: GetCopilotHistoryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetCopilotHistoryResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.count)) {
    body['count'] = request.count;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetCopilotHistory',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/copilot/get_copilot_history`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取copilot历史聊天记录
 *
 * @param request GetCopilotHistoryRequest
 * @return GetCopilotHistoryResponse
 */
async function getCopilotHistory(request: GetCopilotHistoryRequest): GetCopilotHistoryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getCopilotHistoryWithOptions(request, headers, runtime);
}

model GetDiagnosisResultRequest {
  taskId?: string(name='task_id', description='This parameter is required.', example='quzuYl23'),
}

model GetDiagnosisResultResponseBody = {
  code?: string(name='code', example='Success'),
  data?: {
    code?: int32(name='code', example='0'),
    command?: any(name='command', example='{
    "jobs":[
        {
            "cmd":"mkdir -p /var/log/sysak && sysak podmem -r 100  -a -j /var/log/sysak/podmem.json > /dev/null 2>&1 && cat /var/log/sysak/podmem.json",
            "instance":"172.20.12.174",
            "fetch_file_list":[

            ]
        }
    ],
    "in_order":true,
    "offline_mode":false,
    "offline_results":[

    ]
}'),
    createdAt?: string(name='created_at'),
    errMsg?: string(name='err_msg', example='Diagnosis failed'),
    params?: any(name='params', example='{
    "type":"all",
    "value":"",
    "channel":"ssh",
    "instance":"172.1.2.174",
    "service_name":"filecache"
}'),
    result?: any(name='result', example='{
    "summary":"  memory cgroup leak",
    "dataMemEvent":{
        "data":[
            {
                "key":"Util",
                "value":20
            },
            {
                "key":"MemLeak",
                "value":"OK"
            },
            {
                "key":"MemcgLeak",
                "value":"NG"
            },
            {
                "key":"MemFrag",
                "value":"OK"
            }
        ]
    },
    "dataMemOverView":{
        "data":[
            {
                "key":"app",
                "value":10937332
            },
            {
                "key":"free",
                "value":806800
            },
            {
                "key":"kernel",
                "value":4527660
            }
        ]
    },
    "dataKerMem":{
        "data":[
            {
                "key":"SReclaimable",
                "value":3411292
            },
            {
                "key":"VmallocUsed",
                "value":30980
            },
            {
                "key":"allocPage",
                "value":177732
            },
            {
                "key":"KernelStack",
                "value":9280
            },
            {
                "key":"PageTables",
                "value":38056
            },
            {
                "key":"SUnreclaim",
                "value":170248
            },
            {
                "key":"reserved",
                "value":690072
            }
        ]
    },
    "dataUserMem":{
        "data":[
            {
                "key":"filecache",
                "value":8010008
            },
            {
                "key":"anon",
                "value":2468608
            },
            {
                "key":"mlock",
                "value":0
            },
            {
                "key":"huge1G",
                "value":0
            },
            {
                "key":"huge2M",
                "value":0
            },
            {
                "key":"buffers",
                "value":458608
            },
            {
                "key":"shmem",
                "value":2284
            }
        ]
    },
    "dataCacheList":{
        "data":[
            {
                "key":0,
                "Name":"/var/lib/mysql/sysom/sys_handler_log.ibd",
                "cached":576764,
                "Task":"mysqld_78575 "
            },
            {
                "key":1,
                "Name":"/var/log/sysom/sysom-migration-access.log",
                "cached":276688,
                "Task":"gunicorn_33647 ,gunicorn_460836 ,gunicorn_559934 ,gunicorn_731758 ,gunicorn_2362682 "
            },
            {
                "key":2,
                "Name":"/var/log/sysom/sysom-rtdemo-access.log",
                "cached":229404,
                "Task":"gunicorn_60718 ,gunicorn_720734 ,gunicorn_722168 "
            },
            {
                "key":3,
                "Name":"/var/log/sysom/sysom-monitor-server-access.log",
                "cached":197368,
                "Task":"gunicorn_33682 ,gunicorn_671155 ,gunicorn_714998 "
            },
            {
                "key":4,
                "Name":"/var/log/sysom/sysom-channel-access.log",
                "cached":180276,
                "Task":"gunicorn_33233 ,gunicorn_499735 ,gunicorn_725497 "
            },
            {
                "key":5,
                "Name":"total cached of close file",
                "cached":3729668,
                "Task":""
            }
        ]
    },
    "dataProcMemList":{
        "data":[
            {
                "key":0,
                "task":"mysqld",
                "MemTotal":240856,
                "RssAnon":218248,
                "RssFile":22608
            },
            {
                "key":1,
                "task":"systemd-journal",
                "MemTotal":150248,
                "RssAnon":74300,
                "RssFile":75944
            },
            {
                "key":2,
                "task":"gunicorn",
                "MemTotal":144640,
                "RssAnon":114200,
                "RssFile":30440
            },
            {
                "key":3,
                "task":"gunicorn",
                "MemTotal":141480,
                "RssAnon":111040,
                "RssFile":30440
            },
            {
                "key":4,
                "task":"grafana-server",
                "MemTotal":103660,
                "RssAnon":42732,
                "RssFile":60928
            },
            {
                "key":5,
                "task":"gunicorn",
                "MemTotal":97444,
                "RssAnon":76256,
                "RssFile":21188
            },
            {
                "key":6,
                "task":"gunicorn",
                "MemTotal":97260,
                "RssAnon":76072,
                "RssFile":21188
            },
            {
                "key":7,
                "task":"prometheus",
                "MemTotal":95356,
                "RssAnon":45376,
                "RssFile":49980
            },
            {
                "key":8,
                "task":"gunicorn",
                "MemTotal":90144,
                "RssAnon":76456,
                "RssFile":13688
            },
            {
                "key":9,
                "task":"gunicorn",
                "MemTotal":89796,
                "RssAnon":76108,
                "RssFile":13688
            }
        ]
    }
}'),
    serviceName?: string(name='service_name', example='memgraph'),
    status?: string(name='status', example='Running'),
    taskId?: string(name='task_id', example='grcuU21a'),
    updatedAt?: string(name='updated_at'),
    url?: string(name='url', example='/diagnose/detail/qe3Z34sa'),
  }(name='data'),
  message?: string(name='message', example='""'),
  requestId?: string(name='request_id', example='9515E5A0-8905-59B0-9BBF-5F0BE568C3A0'),
}

model GetDiagnosisResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetDiagnosisResultResponseBody(name='body'),
}

/**
 * @summary 获取诊断结果
 *
 * @param request GetDiagnosisResultRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetDiagnosisResultResponse
 */
async function getDiagnosisResultWithOptions(request: GetDiagnosisResultRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetDiagnosisResultResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.taskId)) {
    query['task_id'] = request.taskId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetDiagnosisResult',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/diagnosis/get_diagnosis_results`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取诊断结果
 *
 * @param request GetDiagnosisResultRequest
 * @return GetDiagnosisResultResponse
 */
async function getDiagnosisResult(request: GetDiagnosisResultRequest): GetDiagnosisResultResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getDiagnosisResultWithOptions(request, headers, runtime);
}

model GetHealthPercentageRequest {
  cluster?: string(name='cluster', example='1808078950770264'),
  end?: float(name='end', description='This parameter is required.', example='1725801327754'),
  instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
  start?: float(name='start', description='This parameter is required.', example='1725797727754'),
}

model GetHealthPercentageResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: [ 
    {
      type?: string(name='type', example='health'),
      value?: long(name='value', example='1'),
    }
  ](name='data'),
  message?: string(name='message', example='""'),
}

model GetHealthPercentageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHealthPercentageResponseBody(name='body'),
}

/**
 * @summary 获取一段时间的节点/pod健康度比例
 *
 * @param request GetHealthPercentageRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHealthPercentageResponse
 */
async function getHealthPercentageWithOptions(request: GetHealthPercentageRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetHealthPercentageResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cluster)) {
    query['cluster'] = request.cluster;
  }
  if (!Util.isUnset(request.end)) {
    query['end'] = request.end;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.start)) {
    query['start'] = request.start;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetHealthPercentage',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/range/health_percentage`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取一段时间的节点/pod健康度比例
 *
 * @param request GetHealthPercentageRequest
 * @return GetHealthPercentageResponse
 */
async function getHealthPercentage(request: GetHealthPercentageRequest): GetHealthPercentageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHealthPercentageWithOptions(request, headers, runtime);
}

model GetHostCountRequest {
  cluster?: string(name='cluster', example='1808078950770264'),
  end?: float(name='end', example='1725801327754'),
  instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
  start?: float(name='start', example='1725797727754'),
}

model GetHostCountResponseBody = {
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      time?: long(name='time', example='1725797727754'),
      value?: int32(name='value', example='5'),
    }
  ](name='data'),
  message?: string(name='message', example='“”'),
  requestId?: string(name='request_id', example='43A910E9-A739-525E-855D-A32C257F1826'),
  total?: long(name='total', example='3'),
}

model GetHostCountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHostCountResponseBody(name='body'),
}

/**
 * @summary 获取集群节点数量
 *
 * @param request GetHostCountRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHostCountResponse
 */
async function getHostCountWithOptions(request: GetHostCountRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetHostCountResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cluster)) {
    query['cluster'] = request.cluster;
  }
  if (!Util.isUnset(request.end)) {
    query['end'] = request.end;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.start)) {
    query['start'] = request.start;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetHostCount',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/range/host_count`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取集群节点数量
 *
 * @param request GetHostCountRequest
 * @return GetHostCountResponse
 */
async function getHostCount(request: GetHostCountRequest): GetHostCountResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHostCountWithOptions(request, headers, runtime);
}

model GetHotSpotUniqListRequest {
  begEnd?: long(name='beg_end', description='This parameter is required.', example='1735010351000'),
  begStart?: long(name='beg_start', description='This parameter is required.', example='1735008551000'),
  instance?: string(name='instance', description='This parameter is required.', example='i-bp1g2i0siirefgwnnnvy'),
  pid?: long(name='pid', example='12345'),
  table?: string(name='table', example='prof_on'),
  uniq?: string(name='uniq', description='This parameter is required.'),
}

model GetHotSpotUniqListResponseBody = {
  code?: string(name='code', example='Success'),
  data?: {
    columns?: [ string ](name='columns'),
    values?: [ string ](name='values'),
  }(name='data'),
  message?: string(name='message', example='success'),
  requestId?: string(name='requestId', example='2D693121-C925-5154-8DF6-C09A8B369822'),
  success?: string(name='success', example='true'),
}

model GetHotSpotUniqListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHotSpotUniqListResponseBody(name='body'),
}

/**
 * @summary 获取实例下的某个字段列表
 *
 * @param request GetHotSpotUniqListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHotSpotUniqListResponse
 */
async function getHotSpotUniqListWithOptions(request: GetHotSpotUniqListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetHotSpotUniqListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.begEnd)) {
    body['beg_end'] = request.begEnd;
  }
  if (!Util.isUnset(request.begStart)) {
    body['beg_start'] = request.begStart;
  }
  if (!Util.isUnset(request.instance)) {
    body['instance'] = request.instance;
  }
  if (!Util.isUnset(request.pid)) {
    body['pid'] = request.pid;
  }
  if (!Util.isUnset(request.table)) {
    body['table'] = request.table;
  }
  if (!Util.isUnset(request.uniq)) {
    body['uniq'] = request.uniq;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetHotSpotUniqList',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/livetrace_proxy/hotspot_uniq_list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取实例下的某个字段列表
 *
 * @param request GetHotSpotUniqListRequest
 * @return GetHotSpotUniqListResponse
 */
async function getHotSpotUniqList(request: GetHotSpotUniqListRequest): GetHotSpotUniqListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHotSpotUniqListWithOptions(request, headers, runtime);
}

model GetHotspotAnalysisRequest {
  appType?: string(name='appType', description='This parameter is required.', example='GR'),
  begEnd?: long(name='beg_end', description='This parameter is required.', example='1725413948000'),
  begStart?: long(name='beg_start', description='This parameter is required.', example='1725410348000'),
  instance?: string(name='instance', description='This parameter is required.', example='i-2ze5ru5rjurix7f71sxv'),
  pid?: long(name='pid', example='1657494'),
  table?: string(name='table', example='prof_on'),
}

model GetHotspotAnalysisResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: string(name='data'),
  message?: string(name='message', example='success'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
  success?: boolean(name='success', example='True'),
}

model GetHotspotAnalysisResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHotspotAnalysisResponseBody(name='body'),
}

/**
 * @summary 获取热定分析结果
 *
 * @param request GetHotspotAnalysisRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHotspotAnalysisResponse
 */
async function getHotspotAnalysisWithOptions(request: GetHotspotAnalysisRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetHotspotAnalysisResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appType)) {
    body['appType'] = request.appType;
  }
  if (!Util.isUnset(request.begEnd)) {
    body['beg_end'] = request.begEnd;
  }
  if (!Util.isUnset(request.begStart)) {
    body['beg_start'] = request.begStart;
  }
  if (!Util.isUnset(request.instance)) {
    body['instance'] = request.instance;
  }
  if (!Util.isUnset(request.pid)) {
    body['pid'] = request.pid;
  }
  if (!Util.isUnset(request.table)) {
    body['table'] = request.table;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetHotspotAnalysis',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/proxy/post/livetrace_hotspot_analysis`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取热定分析结果
 *
 * @param request GetHotspotAnalysisRequest
 * @return GetHotspotAnalysisResponse
 */
async function getHotspotAnalysis(request: GetHotspotAnalysisRequest): GetHotspotAnalysisResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHotspotAnalysisWithOptions(request, headers, runtime);
}

model GetHotspotCompareRequest {
  beg1End?: long(name='beg1_end', description='This parameter is required.', example='1725415774000'),
  beg1Start?: long(name='beg1_start', description='This parameter is required.', example='1725415474000'),
  beg2End?: long(name='beg2_end', description='This parameter is required.', example='1725415774000'),
  beg2Start?: long(name='beg2_start', description='This parameter is required.', example='1725415474000'),
  hotType?: string(name='hot_type'),
  instance1?: string(name='instance1', description='This parameter is required.', example='i-2zei55fwj8nnu31h3z46"'),
  instance2?: string(name='instance2', description='This parameter is required.', example='0'),
  pid1?: long(name='pid1', example='0'),
  pid2?: long(name='pid2', example='i-2zei55fwj8nnu31h3z46'),
  table?: string(name='table', description='This parameter is required.', example='prof_on'),
}

model GetHotspotCompareResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: {
    flame?: {
      columns?: [ string ](name='columns'),
      values?: [[ string ]      ](name='values'),
    }(name='flame'),
    seriesInstance1?: {
      columns?: [ string ](name='columns'),
      values?: [[ string ]      ](name='values'),
    }(name='series_instance1'),
    seriesInstance2?: {
      columns?: [ string ](name='columns'),
      values?: [[ string ]      ](name='values'),
    }(name='series_instance2'),
  }(name='data'),
  message?: string(name='message', example='success'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
  success?: boolean(name='success', example='true'),
}

model GetHotspotCompareResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHotspotCompareResponseBody(name='body'),
}

/**
 * @summary 热点对比
 *
 * @param request GetHotspotCompareRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHotspotCompareResponse
 */
async function getHotspotCompareWithOptions(request: GetHotspotCompareRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetHotspotCompareResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.beg1End)) {
    body['beg1_end'] = request.beg1End;
  }
  if (!Util.isUnset(request.beg1Start)) {
    body['beg1_start'] = request.beg1Start;
  }
  if (!Util.isUnset(request.beg2End)) {
    body['beg2_end'] = request.beg2End;
  }
  if (!Util.isUnset(request.beg2Start)) {
    body['beg2_start'] = request.beg2Start;
  }
  if (!Util.isUnset(request.hotType)) {
    body['hot_type'] = request.hotType;
  }
  if (!Util.isUnset(request.instance1)) {
    body['instance1'] = request.instance1;
  }
  if (!Util.isUnset(request.instance2)) {
    body['instance2'] = request.instance2;
  }
  if (!Util.isUnset(request.pid1)) {
    body['pid1'] = request.pid1;
  }
  if (!Util.isUnset(request.pid2)) {
    body['pid2'] = request.pid2;
  }
  if (!Util.isUnset(request.table)) {
    body['table'] = request.table;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetHotspotCompare',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/proxy/post/livetrace_hotspot_compare`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 热点对比
 *
 * @param request GetHotspotCompareRequest
 * @return GetHotspotCompareResponse
 */
async function getHotspotCompare(request: GetHotspotCompareRequest): GetHotspotCompareResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHotspotCompareWithOptions(request, headers, runtime);
}

model GetHotspotInstanceListRequest {
  begEnd?: long(name='beg_end', description='This parameter is required.', example='1725413947000'),
  begStart?: long(name='beg_start', description='This parameter is required.', example='1725413647000'),
  table?: string(name='table', description='This parameter is required.', example='prof_on'),
}

model GetHotspotInstanceListResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: {
    columns?: [ string ](name='columns'),
    values?: [ string ](name='values'),
  }(name='data'),
  message?: string(name='message', example='success'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model GetHotspotInstanceListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHotspotInstanceListResponseBody(name='body'),
}

/**
 * @summary 获取热点实例列表
 *
 * @param request GetHotspotInstanceListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHotspotInstanceListResponse
 */
async function getHotspotInstanceListWithOptions(request: GetHotspotInstanceListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetHotspotInstanceListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.begEnd)) {
    body['beg_end'] = request.begEnd;
  }
  if (!Util.isUnset(request.begStart)) {
    body['beg_start'] = request.begStart;
  }
  if (!Util.isUnset(request.table)) {
    body['table'] = request.table;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetHotspotInstanceList',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/proxy/post/livetrace_hotspot_instance_list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取热点实例列表
 *
 * @param request GetHotspotInstanceListRequest
 * @return GetHotspotInstanceListResponse
 */
async function getHotspotInstanceList(request: GetHotspotInstanceListRequest): GetHotspotInstanceListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHotspotInstanceListWithOptions(request, headers, runtime);
}

model GetHotspotPidListRequest {
  begEnd?: long(name='beg_end', description='This parameter is required.', example='1725413947000'),
  begStart?: long(name='beg_start', description='This parameter is required.', example='1725413647000'),
  instance?: string(name='instance', description='This parameter is required.', example='i-2ze5ru5rjurix7f71sxv'),
  table?: string(name='table', description='This parameter is required.', example='prof_on'),
}

model GetHotspotPidListResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.InvalidParameter'),
  data?: {
    columns?: [ string ](name='columns'),
    values?: [[ string ]    ](name='values'),
  }(name='data'),
  message?: string(name='message', example='Success'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model GetHotspotPidListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHotspotPidListResponseBody(name='body'),
}

/**
 * @summary 获取某个实例的pid列表
 *
 * @param request GetHotspotPidListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHotspotPidListResponse
 */
async function getHotspotPidListWithOptions(request: GetHotspotPidListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetHotspotPidListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.begEnd)) {
    body['beg_end'] = request.begEnd;
  }
  if (!Util.isUnset(request.begStart)) {
    body['beg_start'] = request.begStart;
  }
  if (!Util.isUnset(request.instance)) {
    body['instance'] = request.instance;
  }
  if (!Util.isUnset(request.table)) {
    body['table'] = request.table;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetHotspotPidList',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/proxy/post/livetrace_hotspot_pid_list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取某个实例的pid列表
 *
 * @param request GetHotspotPidListRequest
 * @return GetHotspotPidListResponse
 */
async function getHotspotPidList(request: GetHotspotPidListRequest): GetHotspotPidListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHotspotPidListWithOptions(request, headers, runtime);
}

model GetHotspotTrackingRequest {
  begEnd?: long(name='beg_end', description='This parameter is required.', example='1725413948000'),
  begStart?: long(name='beg_start', description='This parameter is required.', example='1725410348000'),
  hotType?: string(name='hot_type', description='This parameter is required.'),
  instance?: string(name='instance', description='This parameter is required.', example='i-2ze5ru5rjurix7f71sxv'),
  pid?: long(name='pid', example='1657494'),
  table?: string(name='table', description='This parameter is required.', example='prof_on'),
}

model GetHotspotTrackingResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: {
    flame?: {
      columns?: [ string ](name='columns'),
      values?: [[ string ]      ](name='values'),
    }(name='flame'),
    series?: {
      columns?: [ string ](name='columns'),
      values?: [[ string ]      ](name='values'),
    }(name='series'),
  }(name='data'),
  message?: string(name='message', example='Success'),
  requestId?: string(name='requestId', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model GetHotspotTrackingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHotspotTrackingResponseBody(name='body'),
}

/**
 * @summary 发起热点追踪
 *
 * @param request GetHotspotTrackingRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHotspotTrackingResponse
 */
async function getHotspotTrackingWithOptions(request: GetHotspotTrackingRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetHotspotTrackingResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.begEnd)) {
    body['beg_end'] = request.begEnd;
  }
  if (!Util.isUnset(request.begStart)) {
    body['beg_start'] = request.begStart;
  }
  if (!Util.isUnset(request.hotType)) {
    body['hot_type'] = request.hotType;
  }
  if (!Util.isUnset(request.instance)) {
    body['instance'] = request.instance;
  }
  if (!Util.isUnset(request.pid)) {
    body['pid'] = request.pid;
  }
  if (!Util.isUnset(request.table)) {
    body['table'] = request.table;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetHotspotTracking',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/proxy/post/livetrace_hotspot_tracking`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 发起热点追踪
 *
 * @param request GetHotspotTrackingRequest
 * @return GetHotspotTrackingResponse
 */
async function getHotspotTracking(request: GetHotspotTrackingRequest): GetHotspotTrackingResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getHotspotTrackingWithOptions(request, headers, runtime);
}

model GetInstantScoreRequest {
  cluster?: string(name='cluster', example='1808078950770264'),
  instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
}

model GetInstantScoreResponseBody = {
  code?: string(name='code', description='集群ID', example='Success'),
  data?: {
    error?: float(name='error', example='100'),
    latency?: float(name='latency', example='100'),
    load?: float(name='load', example='100'),
    saturation?: float(name='saturation', example='100'),
    total?: float(name='total'),
  }(name='data'),
  message?: string(name='message', example='Query no data'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model GetInstantScoreResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInstantScoreResponseBody(name='body'),
}

/**
 * @summary 获取实时集群/节点健康度分数
 *
 * @param request GetInstantScoreRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetInstantScoreResponse
 */
async function getInstantScoreWithOptions(request: GetInstantScoreRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetInstantScoreResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cluster)) {
    query['cluster'] = request.cluster;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstantScore',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/instant/score`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取实时集群/节点健康度分数
 *
 * @param request GetInstantScoreRequest
 * @return GetInstantScoreResponse
 */
async function getInstantScore(request: GetInstantScoreRequest): GetInstantScoreResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getInstantScoreWithOptions(request, headers, runtime);
}

model GetListRecordRequest {
  current?: long(name='current', example='5'),
  pageSize?: long(name='pageSize', example='10'),
}

model GetListRecordResponseBody = {
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      analysisId?: string(name='analysisId', example='16896fa8-37f6-4c70-bb32-67fa9817d426'),
      analysisTime?: string(name='analysisTime', example='2024-12-24 12:02:05'),
      arguments?: string(name='arguments', example='timeout=2000 ms'),
      failedLog?: string(name='failedLog'),
      status?: string(name='status'),
    }
  ](name='data'),
  message?: string(name='message', example='""'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
  total?: long(name='total', example='19'),
}

model GetListRecordResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetListRecordResponseBody(name='body'),
}

/**
 * @summary AI Infra获取分析记录列表
 *
 * @param request GetListRecordRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetListRecordResponse
 */
async function getListRecordWithOptions(request: GetListRecordRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetListRecordResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetListRecord',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/app_observ/aiAnalysis/list_record`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary AI Infra获取分析记录列表
 *
 * @param request GetListRecordRequest
 * @return GetListRecordResponse
 */
async function getListRecord(request: GetListRecordRequest): GetListRecordResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getListRecordWithOptions(request, headers, runtime);
}

model GetProblemPercentageRequest {
  cluster?: string(name='cluster', example='1808078950770264'),
  end?: float(name='end', description='This parameter is required.', example='1725801327754'),
  instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
  start?: float(name='start', description='This parameter is required.', example='1725797727754'),
}

model GetProblemPercentageResponseBody = {
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      type?: string(name='type', example='saturation'),
      value?: long(name='value', example='5'),
    }
  ](name='data'),
  message?: string(name='message', example='result: code=1 msg=(Request failed, status_code != 200)'),
  requestId?: string(name='request_id', example='35F91AAB-5FDF-5A22-B211-C7C6B00817D0'),
  total?: long(name='total', example='19'),
}

model GetProblemPercentageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetProblemPercentageResponseBody(name='body'),
}

/**
 * @summary 获取一定时间内集群中节点/节点中pod异常问题占比
 *
 * @param request GetProblemPercentageRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetProblemPercentageResponse
 */
async function getProblemPercentageWithOptions(request: GetProblemPercentageRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetProblemPercentageResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cluster)) {
    query['cluster'] = request.cluster;
  }
  if (!Util.isUnset(request.end)) {
    query['end'] = request.end;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.start)) {
    query['start'] = request.start;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetProblemPercentage',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/range/problem_percentage`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取一定时间内集群中节点/节点中pod异常问题占比
 *
 * @param request GetProblemPercentageRequest
 * @return GetProblemPercentageResponse
 */
async function getProblemPercentage(request: GetProblemPercentageRequest): GetProblemPercentageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getProblemPercentageWithOptions(request, headers, runtime);
}

model GetRangeScoreRequest {
  cluster?: string(name='cluster', example='1808078950770264'),
  end?: float(name='end', description='This parameter is required.', example='1725801327754'),
  instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
  start?: float(name='start', description='This parameter is required.', example='1725797727754'),
}

model GetRangeScoreResponseBody = {
  code?: string(name='code', description='代表资源一级ID的资源属性字段', example='Success'),
  data?: [ 
    {
      time?: float(name='time', example='1725797727754'),
      type?: string(name='type', example='saturation'),
      value?: float(name='value', example='100'),
    }
  ](name='data'),
  message?: string(name='message', example='""'),
  requestId?: string(name='request_id', example='35F91AAB-5FDF-5A22-B211-C7C6B00817D0'),
  total?: float(name='total', example='2'),
}

model GetRangeScoreResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetRangeScoreResponseBody(name='body'),
}

/**
 * @summary 获取健康分趋势
 *
 * @param request GetRangeScoreRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetRangeScoreResponse
 */
async function getRangeScoreWithOptions(request: GetRangeScoreRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetRangeScoreResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cluster)) {
    query['cluster'] = request.cluster;
  }
  if (!Util.isUnset(request.end)) {
    query['end'] = request.end;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.start)) {
    query['start'] = request.start;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRangeScore',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/range/score`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取健康分趋势
 *
 * @param request GetRangeScoreRequest
 * @return GetRangeScoreResponse
 */
async function getRangeScore(request: GetRangeScoreRequest): GetRangeScoreResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getRangeScoreWithOptions(request, headers, runtime);
}

model GetResourcesRequest {
  cluster?: string(name='cluster', example='1808078950770264'),
  instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
  type?: string(name='type', example='mem'),
}

model GetResourcesResponseBody = {
  code?: string(name='code', example='Success'),
  data?: {
    total?: float(name='total', example='2354'),
    unit?: string(name='unit', example='Kbytes'),
    usage?: float(name='usage', example='100'),
  }(name='data'),
  message?: string(name='message', example='result: code=1 msg=(Request failed, status_code != 200)'),
  requestId?: string(name='request_id', example='35F91AAB-5FDF-5A22-B211-C7C6B00817D0'),
}

model GetResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourcesResponseBody(name='body'),
}

/**
 * @summary 获取集群/节点资源实时使用情况
 *
 * @param request GetResourcesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourcesResponse
 */
async function getResourcesWithOptions(request: GetResourcesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetResourcesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cluster)) {
    query['cluster'] = request.cluster;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResources',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/instant/resource`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取集群/节点资源实时使用情况
 *
 * @param request GetResourcesRequest
 * @return GetResourcesResponse
 */
async function getResources(request: GetResourcesRequest): GetResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getResourcesWithOptions(request, headers, runtime);
}

model GetServiceFuncStatusRequest {
  channel?: string(name='channel', description='This parameter is required.', example='ecs'),
  params?: {
    functionName?: string(name='function_name', description='This parameter is required.', example='mullprof'),
    instance?: string(name='instance', example='i-2zei55fwj8nnu31h3z46'),
    uid?: string(name='uid', example='1338904783509062'),
  }(name='params', description='This parameter is required.'),
  serviceName?: string(name='service_name', description='This parameter is required.', example='livetrace'),
}

model GetServiceFuncStatusShrinkRequest {
  channel?: string(name='channel', description='This parameter is required.', example='ecs'),
  paramsShrink?: string(name='params', description='This parameter is required.'),
  serviceName?: string(name='service_name', description='This parameter is required.', example='livetrace'),
}

model GetServiceFuncStatusResponseBody = {
  code?: string(name='code', example='Success'),
  data?: {
    args?: {
      addCmd?: string(name='add_cmd', example='java'),
      cpu?: string(name='cpu', example='true'),
      javaStorePath?: string(name='java_store_path', example='/tmp/sysom/java-profiler'),
      locks?: string(name='locks', example='true'),
      loop?: int32(name='loop', example='-1'),
      mem?: string(name='mem', example='true'),
      systemProfiling?: string(name='system_profiling', example='true'),
    }(name='args'),
  }(name='data'),
  message?: string(name='message'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model GetServiceFuncStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetServiceFuncStatusResponseBody(name='body'),
}

/**
 * @summary 获取功能模块配置
 *
 * @param tmpReq GetServiceFuncStatusRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetServiceFuncStatusResponse
 */
async function getServiceFuncStatusWithOptions(tmpReq: GetServiceFuncStatusRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetServiceFuncStatusResponse {
  Util.validateModel(tmpReq);
  var request = new GetServiceFuncStatusShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.params)) {
    request.paramsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.params, 'params', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.channel)) {
    query['channel'] = request.channel;
  }
  if (!Util.isUnset(request.paramsShrink)) {
    query['params'] = request.paramsShrink;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['service_name'] = request.serviceName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetServiceFuncStatus',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/func-switch/get-service-func-status`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取功能模块配置
 *
 * @param request GetServiceFuncStatusRequest
 * @return GetServiceFuncStatusResponse
 */
async function getServiceFuncStatus(request: GetServiceFuncStatusRequest): GetServiceFuncStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getServiceFuncStatusWithOptions(request, headers, runtime);
}

model InitialSysomRequest {
  checkOnly?: boolean(name='check_only'),
}

model InitialSysomResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code'),
  data?: {
    roleExist?: boolean(name='role_exist'),
  }(name='data'),
  message?: string(name='message'),
}

model InitialSysomResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InitialSysomResponseBody(name='body'),
}

/**
 * @summary 初始化SysOM，确保角色存在
 *
 * @param request InitialSysomRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return InitialSysomResponse
 */
async function initialSysomWithOptions(request: InitialSysomRequest, headers: map[string]string, runtime: Util.RuntimeOptions): InitialSysomResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.checkOnly)) {
    body['check_only'] = request.checkOnly;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'InitialSysom',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/initial`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 初始化SysOM，确保角色存在
 *
 * @param request InitialSysomRequest
 * @return InitialSysomResponse
 */
async function initialSysom(request: InitialSysomRequest): InitialSysomResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return initialSysomWithOptions(request, headers, runtime);
}

model InstallAgentRequest {
  agentId?: string(name='agent_id', description='This parameter is required.'),
  agentVersion?: string(name='agent_version', description='This parameter is required.'),
  installType?: string(name='install_type', description='This parameter is required.', example='InstallAndUpgrade'),
  instances?: [ 
    {
      instance?: string(name='instance', description='This parameter is required.', example='i-wz9b9vucz1iubsz8sjqo'),
      region?: string(name='region', description='This parameter is required.', example='cn-hangzhou'),
    }
  ](name='instances', description='This parameter is required.'),
}

model InstallAgentResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: {
    taskId?: string(name='task_id'),
  }(name='data'),
  message?: string(name='message', example='""'),
}

model InstallAgentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InstallAgentResponseBody(name='body'),
}

/**
 * @summary 在指定的实例上安装 Agent
 *
 * @param request InstallAgentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return InstallAgentResponse
 */
async function installAgentWithOptions(request: InstallAgentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): InstallAgentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.agentId)) {
    body['agent_id'] = request.agentId;
  }
  if (!Util.isUnset(request.agentVersion)) {
    body['agent_version'] = request.agentVersion;
  }
  if (!Util.isUnset(request.installType)) {
    body['install_type'] = request.installType;
  }
  if (!Util.isUnset(request.instances)) {
    body['instances'] = request.instances;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'InstallAgent',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/install_agent`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 在指定的实例上安装 Agent
 *
 * @param request InstallAgentRequest
 * @return InstallAgentResponse
 */
async function installAgent(request: InstallAgentRequest): InstallAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return installAgentWithOptions(request, headers, runtime);
}

model InstallAgentForClusterRequest {
  agentId?: string(name='agent_id', example='74a86327-3170-412c-8e67-da3389ec56a9'),
  agentVersion?: string(name='agent_version', example='3.4.0-1'),
  clusterId?: string(name='cluster_id', example='c9d7f3fc3d42942afbcb65c1100ffb19d'),
  grayscaleConfig?: string(name='grayscale_config'),
}

model InstallAgentForClusterResponseBody = {
  requestId?: string(name='RequestId', example='B149FD9C-ED5C-5765-B3AD-05AA4A4D64D7'),
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: {
    taskId?: string(name='task_id', example='049ea0609515414b9e19c3389d7ba638'),
  }(name='data'),
  message?: string(name='message', example='success'),
}

model InstallAgentForClusterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InstallAgentForClusterResponseBody(name='body'),
}

/**
 * @summary 给集群安装组件
 *
 * @param request InstallAgentForClusterRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return InstallAgentForClusterResponse
 */
async function installAgentForClusterWithOptions(request: InstallAgentForClusterRequest, headers: map[string]string, runtime: Util.RuntimeOptions): InstallAgentForClusterResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.agentId)) {
    body['agent_id'] = request.agentId;
  }
  if (!Util.isUnset(request.agentVersion)) {
    body['agent_version'] = request.agentVersion;
  }
  if (!Util.isUnset(request.clusterId)) {
    body['cluster_id'] = request.clusterId;
  }
  if (!Util.isUnset(request.grayscaleConfig)) {
    body['grayscale_config'] = request.grayscaleConfig;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'InstallAgentForCluster',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/install_agent_by_cluster`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 给集群安装组件
 *
 * @param request InstallAgentForClusterRequest
 * @return InstallAgentForClusterResponse
 */
async function installAgentForCluster(request: InstallAgentForClusterRequest): InstallAgentForClusterResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return installAgentForClusterWithOptions(request, headers, runtime);
}

model InvokeAnomalyDiagnosisRequest {
  uuid?: string(name='uuid', example='8047d763-5465-4a8c-b1cd-23f5a8ba2594'),
}

model InvokeAnomalyDiagnosisResponseBody = {
  code?: string(name='code', example='Success'),
  message?: string(name='message', example='success'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model InvokeAnomalyDiagnosisResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InvokeAnomalyDiagnosisResponseBody(name='body'),
}

/**
 * @summary 异常项诊断跳转
 *
 * @param request InvokeAnomalyDiagnosisRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return InvokeAnomalyDiagnosisResponse
 */
async function invokeAnomalyDiagnosisWithOptions(request: InvokeAnomalyDiagnosisRequest, headers: map[string]string, runtime: Util.RuntimeOptions): InvokeAnomalyDiagnosisResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.uuid)) {
    query['uuid'] = request.uuid;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'InvokeAnomalyDiagnosis',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/diagnosis/invoke_anomaly_diagnose`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 异常项诊断跳转
 *
 * @param request InvokeAnomalyDiagnosisRequest
 * @return InvokeAnomalyDiagnosisResponse
 */
async function invokeAnomalyDiagnosis(request: InvokeAnomalyDiagnosisRequest): InvokeAnomalyDiagnosisResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return invokeAnomalyDiagnosisWithOptions(request, headers, runtime);
}

model InvokeDiagnosisRequest {
  channel?: string(name='channel', description='This parameter is required.', example='cloud_assist'),
  params?: string(name='params', description='This parameter is required.', example='{
    "instance": "i-wz9gdv7qmdhusamc4dl01",
    "uid": "xxxxxxxxxxxxxx",
    "region": "cn-shenzhen"
}'),
  serviceName?: string(name='service_name', description='This parameter is required.', example='memgraph'),
}

model InvokeDiagnosisResponseBody = {
  code?: string(name='code', example='Success'),
  data?: {
    taskId?: string(name='task_id', example='ihqhAcrt'),
  }(name='data'),
  message?: string(name='message', example='SysomOpenAPIAssumeRoleException: EntityNotExist.Role The role not exists: acs:ram::xxxxx:role/aliyunserviceroleforsysom'),
  requestId?: string(name='request_id'),
}

model InvokeDiagnosisResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InvokeDiagnosisResponseBody(name='body'),
}

/**
 * @summary 发起诊断
 *
 * @param request InvokeDiagnosisRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return InvokeDiagnosisResponse
 */
async function invokeDiagnosisWithOptions(request: InvokeDiagnosisRequest, headers: map[string]string, runtime: Util.RuntimeOptions): InvokeDiagnosisResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channel)) {
    body['channel'] = request.channel;
  }
  if (!Util.isUnset(request.params)) {
    body['params'] = request.params;
  }
  if (!Util.isUnset(request.serviceName)) {
    body['service_name'] = request.serviceName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'InvokeDiagnosis',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/diagnosis/invoke_diagnosis`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 发起诊断
 *
 * @param request InvokeDiagnosisRequest
 * @return InvokeDiagnosisResponse
 */
async function invokeDiagnosis(request: InvokeDiagnosisRequest): InvokeDiagnosisResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return invokeDiagnosisWithOptions(request, headers, runtime);
}

model ListAbnormalyEventsRequest {
  cluster?: string(name='cluster', example='1808078950770264'),
  current?: int32(name='current', example='1'),
  end?: float(name='end', example='1725801327754'),
  instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
  level?: string(name='level', example='potential'),
  namespace?: string(name='namespace', example='default'),
  pageSize?: int32(name='pageSize', example='10'),
  pod?: string(name='pod', example='test-pod'),
  showPod?: int32(name='showPod', example='1'),
  start?: float(name='start', example='1725797727754'),
}

model ListAbnormalyEventsResponseBody = {
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      createdAt?: float(name='created_at', example='1725801090000'),
      description?: string(name='description'),
      id?: string(name='id', example='1'),
      instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
      item?: string(name='item'),
      opts?: {
        label?: string(name='label', example='diagnose'),
        params?: string(name='params', example='"{\\\\"service_name\\\\": \\\\"oomcheck\\\\", \\\\"params\\\\": {\\\\"auto_initial\\\\": true, \\\\"instance\\\\": \\\\"i-wz9d00ut2ska3mlyhn6i\\\\", \\\\"region\\\\": \\\\"cn-shenzhen\\\\", \\\\"uuid\\\\": \\\\"24576d0c-a19d-49dd-8a64-3867440fd7a6\\\\", \\\\"is_history\\\\": 1}}"'),
        type?: string(name='type', example='realtime'),
      }(name='opts'),
      regionId?: string(name='region_id', example='cn-shanghai'),
      type?: string(name='type', example='saturation'),
    }
  ](name='data'),
  message?: string(name='message'),
}

model ListAbnormalyEventsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAbnormalyEventsResponseBody(name='body'),
}

/**
 * @summary 获取一定时间段内的异常事件
 *
 * @param request ListAbnormalyEventsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAbnormalyEventsResponse
 */
async function listAbnormalyEventsWithOptions(request: ListAbnormalyEventsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListAbnormalyEventsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cluster)) {
    query['cluster'] = request.cluster;
  }
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.end)) {
    query['end'] = request.end;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.level)) {
    query['level'] = request.level;
  }
  if (!Util.isUnset(request.namespace)) {
    query['namespace'] = request.namespace;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pod)) {
    query['pod'] = request.pod;
  }
  if (!Util.isUnset(request.showPod)) {
    query['showPod'] = request.showPod;
  }
  if (!Util.isUnset(request.start)) {
    query['start'] = request.start;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAbnormalyEvents',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/range/abnormaly_events`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取一定时间段内的异常事件
 *
 * @param request ListAbnormalyEventsRequest
 * @return ListAbnormalyEventsResponse
 */
async function listAbnormalyEvents(request: ListAbnormalyEventsRequest): ListAbnormalyEventsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listAbnormalyEventsWithOptions(request, headers, runtime);
}

model ListAgentInstallRecordsRequest {
  current?: long(name='current'),
  instanceId?: string(name='instance_id'),
  pageSize?: long(name='pageSize'),
  pluginId?: string(name='plugin_id'),
  pluginVersion?: string(name='plugin_version'),
  status?: string(name='status'),
}

model ListAgentInstallRecordsResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      createdAt?: string(name='created_at'),
      instanceId?: string(name='instance_id'),
      pluginId?: string(name='plugin_id'),
      pluginVersion?: string(name='plugin_version'),
      status?: string(name='status'),
      updatedAt?: string(name='updated_at'),
    }
  ](name='data'),
  message?: string(name='message', example='SysomOpenAPIAssumeRoleException: EntityNotExist.Role The role not exists: acs:ram::xxxxx:role/aliyunserviceroleforsysom'),
  total?: long(name='total', example='64'),
}

model ListAgentInstallRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAgentInstallRecordsResponseBody(name='body'),
}

/**
 * @summary 列出 Agent 的安装记录
 *
 * @param request ListAgentInstallRecordsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAgentInstallRecordsResponse
 */
async function listAgentInstallRecordsWithOptions(request: ListAgentInstallRecordsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListAgentInstallRecordsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['instance_id'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pluginId)) {
    query['plugin_id'] = request.pluginId;
  }
  if (!Util.isUnset(request.pluginVersion)) {
    query['plugin_version'] = request.pluginVersion;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgentInstallRecords',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/list_agent_install_list`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 列出 Agent 的安装记录
 *
 * @param request ListAgentInstallRecordsRequest
 * @return ListAgentInstallRecordsResponse
 */
async function listAgentInstallRecords(request: ListAgentInstallRecordsRequest): ListAgentInstallRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listAgentInstallRecordsWithOptions(request, headers, runtime);
}

model ListAgentsRequest {
  current?: long(name='current'),
  name?: string(name='name'),
  pageSize?: long(name='pageSize'),
  type?: string(name='type'),
}

model ListAgentsResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      createdAt?: string(name='created_at'),
      description?: string(name='description'),
      id?: string(name='id'),
      name?: string(name='name', example='SysOM Agent'),
      supportArch?: string(name='support_arch', example='x86'),
      type?: string(name='type', example='Control'),
      updatedAt?: string(name='updated_at'),
      versions?: [ 
        {
          createdAt?: string(name='created_at'),
          installScript?: string(name='install_script'),
          uninstallScript?: string(name='uninstall_script'),
          updatedAt?: string(name='updated_at'),
          upgradeScript?: string(name='upgrade_script'),
          version?: string(name='version'),
        }
      ](name='versions'),
    }
  ](name='data'),
  message?: string(name='message', example='SysomOpenAPIAssumeRoleException: EntityNotExist.Role The role not exists: acs:ram::xxxxx:role/aliyunserviceroleforsysom'),
  total?: long(name='total'),
}

model ListAgentsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAgentsResponseBody(name='body'),
}

/**
 * @summary 获取 Agent 列表
 *
 * @param request ListAgentsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAgentsResponse
 */
async function listAgentsWithOptions(request: ListAgentsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListAgentsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgents',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/list_agents`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取 Agent 列表
 *
 * @param request ListAgentsRequest
 * @return ListAgentsResponse
 */
async function listAgents(request: ListAgentsRequest): ListAgentsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listAgentsWithOptions(request, headers, runtime);
}

model ListClusterAgentInstallRecordsRequest {
  clusterId?: string(name='cluster_id', example='cbd80af02b9d6454ebdc579c5e022d0c8'),
  current?: long(name='current', example='1'),
  pageSize?: long(name='pageSize', example='10'),
  pluginId?: string(name='plugin_id', example='74a86327-3170-412c-8e67-da3389ec56a9'),
  pluginVersion?: string(name='plugin_version', example='3.4.0-1'),
}

model ListClusterAgentInstallRecordsResponseBody = {
  requestId?: string(name='RequestId', example='B149FD9C-ED5C-5765-B3AD-05AA4A4D64D7'),
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      clusterId?: string(name='cluster_id', example='cbf7a37bc905d4682a3338b3744810269'),
      createdAt?: string(name='created_at', example='2024-12-25T15:08:19'),
      grayscaleConfig?: string(name='grayscale_config'),
      pluginId?: string(name='plugin_id', example='74a86327-3170-412c-8e67-da3389ec56a9'),
      pluginVersion?: string(name='plugin_version', example='3.4.0-1'),
      updatedAt?: string(name='updated_at', example='2024-12-25T15:08:19'),
    }
  ](name='data'),
  message?: string(name='message', example='success'),
  total?: long(name='total', example='42'),
}

model ListClusterAgentInstallRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListClusterAgentInstallRecordsResponseBody(name='body'),
}

/**
 * @summary 获取集群组件安装记录
 *
 * @param request ListClusterAgentInstallRecordsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListClusterAgentInstallRecordsResponse
 */
async function listClusterAgentInstallRecordsWithOptions(request: ListClusterAgentInstallRecordsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListClusterAgentInstallRecordsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clusterId)) {
    query['cluster_id'] = request.clusterId;
  }
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pluginId)) {
    query['plugin_id'] = request.pluginId;
  }
  if (!Util.isUnset(request.pluginVersion)) {
    query['plugin_version'] = request.pluginVersion;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListClusterAgentInstallRecords',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/list_cluster_agent_install_list`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取集群组件安装记录
 *
 * @param request ListClusterAgentInstallRecordsRequest
 * @return ListClusterAgentInstallRecordsResponse
 */
async function listClusterAgentInstallRecords(request: ListClusterAgentInstallRecordsRequest): ListClusterAgentInstallRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listClusterAgentInstallRecordsWithOptions(request, headers, runtime);
}

model ListClustersRequest {
  clusterId?: string(name='cluster_id', example='cb7d4cc26c8f845fb8a8255ffd394820e'),
  clusterStatus?: string(name='cluster_status', example='Running'),
  clusterType?: string(name='cluster_type', example='ACK'),
  current?: long(name='current', example='1'),
  id?: string(name='id', example='cb7d4cc26c8f845fb8a8255ffd394820e'),
  name?: string(name='name', example='proxy-next-upstream'),
  pageSize?: long(name='pageSize', example='10'),
}

model ListClustersResponseBody = {
  requestId?: string(name='RequestId', example='B149FD9C-ED5C-5765-B3AD-05AA4A4D64D7'),
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      clusterId?: string(name='cluster_id', example='c666d4774f0e2440b979bf917bf100e40'),
      clusterStatus?: string(name='cluster_status', example='Running'),
      clusterType?: string(name='cluster_type', example='ACK'),
      createdAt?: string(name='created_at', example='2024-12-25T15:08:19'),
      id?: string(name='id', example='5389fba5-92a1-4ff4-9b26-773b97828144'),
      name?: string(name='name', example='auto-name-sbvCT'),
      region?: string(name='region', example='cn-hangzhou'),
      updatedAt?: string(name='updated_at', example='2024-12-25T15:08:19'),
    }
  ](name='data'),
  message?: string(name='message', example='success'),
  total?: long(name='total', example='64'),
}

model ListClustersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListClustersResponseBody(name='body'),
}

/**
 * @summary 获取当前用户的所有集群
 *
 * @param request ListClustersRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListClustersResponse
 */
async function listClustersWithOptions(request: ListClustersRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListClustersResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clusterId)) {
    query['cluster_id'] = request.clusterId;
  }
  if (!Util.isUnset(request.clusterStatus)) {
    query['cluster_status'] = request.clusterStatus;
  }
  if (!Util.isUnset(request.clusterType)) {
    query['cluster_type'] = request.clusterType;
  }
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.id)) {
    query['id'] = request.id;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListClusters',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/cluster/list_clusters`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取当前用户的所有集群
 *
 * @param request ListClustersRequest
 * @return ListClustersResponse
 */
async function listClusters(request: ListClustersRequest): ListClustersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listClustersWithOptions(request, headers, runtime);
}

model ListDiagnosisRequest {
  current?: long(name='current'),
  pageSize?: long(name='pageSize', example='10'),
  params?: string(name='params'),
  serviceName?: string(name='service_name'),
  status?: string(name='status'),
}

model ListDiagnosisResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      code?: int32(name='code'),
      command?: any(name='command'),
      createdAt?: string(name='created_at'),
      errMsg?: string(name='err_msg'),
      params?: any(name='params'),
      result?: any(name='result'),
      serviceName?: string(name='service_name'),
      status?: string(name='status'),
      taskId?: string(name='task_id'),
      updatedAt?: string(name='updated_at'),
      url?: string(name='url'),
    }
  ](name='data'),
  message?: string(name='message', description='This parameter is required.', example='SysomOpenAPIAssumeRoleException: EntityNotExist.Role The role not exists: acs:ram::xxxxx:role/aliyunserviceroleforsysom'),
  total?: long(name='total'),
}

model ListDiagnosisResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDiagnosisResponseBody(name='body'),
}

/**
 * @summary 获取诊断历史记录列表
 *
 * @param request ListDiagnosisRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDiagnosisResponse
 */
async function listDiagnosisWithOptions(request: ListDiagnosisRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDiagnosisResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.params)) {
    query['params'] = request.params;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['service_name'] = request.serviceName;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDiagnosis',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/diagnosis/list_diagnosis`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取诊断历史记录列表
 *
 * @param request ListDiagnosisRequest
 * @return ListDiagnosisResponse
 */
async function listDiagnosis(request: ListDiagnosisRequest): ListDiagnosisResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDiagnosisWithOptions(request, headers, runtime);
}

model ListInstanceHealthRequest {
  cluster?: string(name='cluster', example='1808078950770264'),
  current?: int32(name='current', example='1'),
  end?: float(name='end', description='This parameter is required.', example='1725801327754'),
  instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
  pageSize?: int32(name='pageSize', example='10'),
  start?: float(name='start', description='This parameter is required.', example='1725797727754'),
}

model ListInstanceHealthResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: {
    images?: [ string ](name='images'),
    instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
    namespace?: string(name='namespace', example='default'),
    pod?: string(name='pod', example='test-pod'),
    regionId?: string(name='region_id', example='cn-shenzhen'),
    score?: float(name='score', example='100'),
    status?: string(name='status', example='Running'),
  }(name='data'),
  message?: string(name='message', example='Query no data'),
  requestId?: string(name='request_id', example='35F91AAB-5FDF-5A22-B211-C7C6B00817D0'),
  total?: int32(name='total', example='42'),
}

model ListInstanceHealthResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceHealthResponseBody(name='body'),
}

/**
 * @summary 获取一定时间内集群节点/Pod健康度列表
 *
 * @param request ListInstanceHealthRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstanceHealthResponse
 */
async function listInstanceHealthWithOptions(request: ListInstanceHealthRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstanceHealthResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.cluster)) {
    query['cluster'] = request.cluster;
  }
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.end)) {
    query['end'] = request.end;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.start)) {
    query['start'] = request.start;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstanceHealth',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/cluster_health/range/instance_health_list`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取一定时间内集群节点/Pod健康度列表
 *
 * @param request ListInstanceHealthRequest
 * @return ListInstanceHealthResponse
 */
async function listInstanceHealth(request: ListInstanceHealthRequest): ListInstanceHealthResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstanceHealthWithOptions(request, headers, runtime);
}

model ListInstanceStatusRequest {
  current?: long(name='current', example='1'),
  instance?: string(name='instance', example='i-wz9b9vucz1iubsz355rh'),
  pageSize?: long(name='pageSize', example='10'),
  region?: string(name='region', example='cn-shenzhen'),
  status?: string(name='status', example='Running'),
}

model ListInstanceStatusResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      instance?: string(name='instance'),
      region?: string(name='region'),
      status?: string(name='status', example='Running'),
    }
  ](name='data'),
  message?: string(name='message', example='SysomOpenAPIAssumeRoleException: EntityNotExist.Role The role not exists: acs:ram::xxxxx:role/aliyunserviceroleforsysom'),
  total?: long(name='total', example='218'),
}

model ListInstanceStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceStatusResponseBody(name='body'),
}

/**
 * @summary 获取实例状态
 *
 * @param request ListInstanceStatusRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstanceStatusResponse
 */
async function listInstanceStatusWithOptions(request: ListInstanceStatusRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstanceStatusResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.region)) {
    query['region'] = request.region;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstanceStatus',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/instance/list_instance_status`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取实例状态
 *
 * @param request ListInstanceStatusRequest
 * @return ListInstanceStatusResponse
 */
async function listInstanceStatus(request: ListInstanceStatusRequest): ListInstanceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstanceStatusWithOptions(request, headers, runtime);
}

model ListInstancesRequest {
  clusterId?: string(name='cluster_id', example='xxxxx'),
  current?: long(name='current', example='1'),
  instance?: string(name='instance'),
  pageSize?: long(name='pageSize', example='10'),
  region?: string(name='region', example='cn-shenzhen'),
  status?: string(name='status', example='Running'),
}

model ListInstancesResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.ServerError'),
  data?: [ 
    {
      clusterId?: string(name='cluster_id'),
      instance?: string(name='instance'),
      kernelVersion?: string(name='kernel_version'),
      meta?: any(name='meta'),
      osArch?: string(name='os_arch'),
      osHealthScore?: string(name='os_health_score'),
      osName?: string(name='os_name'),
      osNameId?: string(name='os_name_id'),
      osVersion?: string(name='os_version'),
      osVersionId?: string(name='os_version_id'),
      region?: string(name='region', example='cn-hangzhou'),
      status?: string(name='status', example='Running'),
    }
  ](name='data'),
  message?: string(name='message', example='Requests for llm service failed'),
  requestId?: string(name='request_id', example='9515E5A0-8905-59B0-9BBF-5F0BE568C3A0'),
  total?: long(name='total', example='623'),
}

model ListInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesResponseBody(name='body'),
}

/**
 * @summary 获取实例列表
 *
 * @param request ListInstancesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesResponse
 */
async function listInstancesWithOptions(request: ListInstancesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstancesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clusterId)) {
    query['cluster_id'] = request.clusterId;
  }
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.region)) {
    query['region'] = request.region;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstances',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/instance/list_instances`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取实例列表
 *
 * @param request ListInstancesRequest
 * @return ListInstancesResponse
 */
async function listInstances(request: ListInstancesRequest): ListInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstancesWithOptions(request, headers, runtime);
}

model ListInstancesEcsInfoListRequest {
  infoType?: string(name='info_type', description='This parameter is required.', example='ip'),
  instanceId?: string(name='instance_id', example='i-bp118piqcio9tiwgh84b'),
  managedType?: string(name='managed_type', example='managed'),
  pluginId?: string(name='plugin_id', example='74a86327-3170-412c-8e67-da3389ec56a9'),
  region?: string(name='region', description='This parameter is required.', example='cn-shenzhen'),
}

model ListInstancesEcsInfoListResponseBody = {
  code?: string(name='code', example='SysomOpenAPI.InvalidParameter'),
  data?: [ 
    {
      ip?: string(name='ip', example='11.193.52.91'),
      tagKey?: string(name='tag_key', example='sysom'),
      tagValue?: string(name='tag_value', example='diagnosis'),
      type?: string(name='type', example='public'),
    }
  ](name='data'),
  message?: string(name='message', example='""'),
}

model ListInstancesEcsInfoListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesEcsInfoListResponseBody(name='body'),
}

/**
 * @summary 获取ecs信息的列表，如标签列表，公网ip列表等
 *
 * @param request ListInstancesEcsInfoListRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesEcsInfoListResponse
 */
async function listInstancesEcsInfoListWithOptions(request: ListInstancesEcsInfoListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstancesEcsInfoListResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.infoType)) {
    query['info_type'] = request.infoType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['instance_id'] = request.instanceId;
  }
  if (!Util.isUnset(request.managedType)) {
    query['managed_type'] = request.managedType;
  }
  if (!Util.isUnset(request.pluginId)) {
    query['plugin_id'] = request.pluginId;
  }
  if (!Util.isUnset(request.region)) {
    query['region'] = request.region;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstancesEcsInfoList',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/instance/listInstancesEcsInfoList`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取ecs信息的列表，如标签列表，公网ip列表等
 *
 * @param request ListInstancesEcsInfoListRequest
 * @return ListInstancesEcsInfoListResponse
 */
async function listInstancesEcsInfoList(request: ListInstancesEcsInfoListRequest): ListInstancesEcsInfoListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstancesEcsInfoListWithOptions(request, headers, runtime);
}

model ListInstancesWithEcsInfoRequest {
  current?: int32(name='current', example='1'),
  healthStatus?: string(name='health_status', example='healthy'),
  instanceId?: string(name='instance_id', example='i-bp118piqcio9tiwgh84b'),
  instanceIdName?: string(name='instance_id_name', example='84b'),
  instanceName?: string(name='instance_name', example='block-load-balancer-hjdm9'),
  instanceTag?: {
    key?: string(name='key', example='feature_dim_radar_chart'),
    value?: string(name='value', example='test'),
  }(name='instance_tag'),
  isManaged?: int32(name='is_managed', example='1'),
  osName?: string(name='os_name', example='Alibaba Cloud Linux  3.2104 LTS 64bit'),
  pageSize?: int32(name='pageSize', example='10'),
  privateIp?: string(name='private_ip', example='1.1.1.1'),
  publicIp?: string(name='public_ip', example='1.1.1.1'),
  region?: string(name='region', description='This parameter is required.', example='cn-shenzhen'),
  resourceGroupId?: string(name='resource_group_id', example='rg-xxxxxxx'),
  resourceGroupIdName?: string(name='resource_group_id_name', example='default'),
  resourceGroupName?: string(name='resource_group_name', example='default resource group'),
}

model ListInstancesWithEcsInfoShrinkRequest {
  current?: int32(name='current', example='1'),
  healthStatus?: string(name='health_status', example='healthy'),
  instanceId?: string(name='instance_id', example='i-bp118piqcio9tiwgh84b'),
  instanceIdName?: string(name='instance_id_name', example='84b'),
  instanceName?: string(name='instance_name', example='block-load-balancer-hjdm9'),
  instanceTagShrink?: string(name='instance_tag'),
  isManaged?: int32(name='is_managed', example='1'),
  osName?: string(name='os_name', example='Alibaba Cloud Linux  3.2104 LTS 64bit'),
  pageSize?: int32(name='pageSize', example='10'),
  privateIp?: string(name='private_ip', example='1.1.1.1'),
  publicIp?: string(name='public_ip', example='1.1.1.1'),
  region?: string(name='region', description='This parameter is required.', example='cn-shenzhen'),
  resourceGroupId?: string(name='resource_group_id', example='rg-xxxxxxx'),
  resourceGroupIdName?: string(name='resource_group_id_name', example='default'),
  resourceGroupName?: string(name='resource_group_name', example='default resource group'),
}

model ListInstancesWithEcsInfoResponseBody = {
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      clusterId?: string(name='cluster_id', example='cbf7a37bc905d4682a3338b3744810269'),
      instanceId?: string(name='instance_id', example='i-bp118piqcio9tiwgh84b'),
      instanceName?: string(name='instance_name', example='allowed-repos-r2tzl'),
      instanceTag?: [ 
        {
          tagKey?: string(name='tag_key', example='test_tag_key'),
          tagValue?: string(name='tag_value', example='test_tag_value'),
        }
      ](name='instance_tag'),
      osArch?: string(name='os_arch', example='x86'),
      osHealthScore?: string(name='os_health_score', example='100'),
      osName?: string(name='os_name', example='Alibaba Cloud Linux  3.2104 LTS 64bit'),
      privateIp?: string(name='private_ip', example='1.1.1.1'),
      publicIp?: string(name='public_ip', example='1.1.1.1'),
      resourceGroupId?: string(name='resource_group_id', example='rg-xxxxxx'),
      resourceGroupName?: string(name='resource_group_name', example='default resource group'),
      status?: string(name='status', example='Running'),
    }
  ](name='data'),
  message?: string(name='message', example='result: code=1 msg=(Request failed, status_code != 200)'),
  requestId?: string(name='request_id', example='35F91AAB-5FDF-5A22-B211-C7C6B00817D0'),
  total?: long(name='total', example='319'),
}

model ListInstancesWithEcsInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesWithEcsInfoResponseBody(name='body'),
}

/**
 * @summary 获取已纳管/未纳管实例信息，信息中包含ECS信息
 *
 * @param tmpReq ListInstancesWithEcsInfoRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesWithEcsInfoResponse
 */
async function listInstancesWithEcsInfoWithOptions(tmpReq: ListInstancesWithEcsInfoRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstancesWithEcsInfoResponse {
  Util.validateModel(tmpReq);
  var request = new ListInstancesWithEcsInfoShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.instanceTag)) {
    request.instanceTagShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.instanceTag, 'instance_tag', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.healthStatus)) {
    query['health_status'] = request.healthStatus;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['instance_id'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceIdName)) {
    query['instance_id_name'] = request.instanceIdName;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['instance_name'] = request.instanceName;
  }
  if (!Util.isUnset(request.instanceTagShrink)) {
    query['instance_tag'] = request.instanceTagShrink;
  }
  if (!Util.isUnset(request.isManaged)) {
    query['is_managed'] = request.isManaged;
  }
  if (!Util.isUnset(request.osName)) {
    query['os_name'] = request.osName;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.privateIp)) {
    query['private_ip'] = request.privateIp;
  }
  if (!Util.isUnset(request.publicIp)) {
    query['public_ip'] = request.publicIp;
  }
  if (!Util.isUnset(request.region)) {
    query['region'] = request.region;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['resource_group_id'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.resourceGroupIdName)) {
    query['resource_group_id_name'] = request.resourceGroupIdName;
  }
  if (!Util.isUnset(request.resourceGroupName)) {
    query['resource_group_name'] = request.resourceGroupName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstancesWithEcsInfo',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/instance/listInstancesWithEcsInfo`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取已纳管/未纳管实例信息，信息中包含ECS信息
 *
 * @param request ListInstancesWithEcsInfoRequest
 * @return ListInstancesWithEcsInfoResponse
 */
async function listInstancesWithEcsInfo(request: ListInstancesWithEcsInfoRequest): ListInstancesWithEcsInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstancesWithEcsInfoWithOptions(request, headers, runtime);
}

model ListPluginsInstancesRequest {
  current?: long(name='current', example='5'),
  instanceIdName?: string(name='instance_id_name', example='i-bpxx'),
  instanceTag?: string(name='instance_tag', example='{"key":"app","value":"sysom-aliyun-com"}'),
  operationType?: string(name='operation_type', description='This parameter is required.', example='install'),
  pageSize?: long(name='pageSize', example='20'),
  pluginId?: string(name='plugin_id', description='This parameter is required.', example='74a86327-3170-412c-8e67-da3389ec56a9'),
  region?: string(name='region', description='This parameter is required.', example='cn-shenzhen'),
}

model ListPluginsInstancesResponseBody = {
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      instanceId?: string(name='instance_id', example='i-bp118piqcio9tiwgh84b'),
      instanceName?: string(name='instance_name', example='allowed-repos-qmf8w'),
      instanceTag?: [ 
        {
          tagKey?: string(name='tag_key', example='test_tag_key'),
          tagValue?: string(name='tag_value', example='test_tag_value'),
        }
      ](name='instance_tag'),
      osName?: string(name='os_name', example='Alibaba Cloud Linux  3.2104 LTS 64 bit'),
      privateIp?: string(name='private_ip', example='1.1.1.1'),
      publicIp?: string(name='public_ip', example='1.1.1.1'),
      region?: string(name='region', example='cn-hangzhou'),
      resourceGroupId?: string(name='resource_group_id', example='rg-xxxx'),
      resourceGroupName?: string(name='resource_group_name', example='default resource group'),
    }
  ](name='data'),
  message?: string(name='message', example='SysomOpenAPIException: SysomOpenAPI.InvalidParameter Invalid params, should be json string or dict'),
  requestId?: string(name='request_id', example='35F91AAB-5FDF-5A22-B211-C7C6B00817D0'),
  total?: long(name='total', example='42'),
}

model ListPluginsInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListPluginsInstancesResponseBody(name='body'),
}

/**
 * @summary 获取插件的安装/更新/卸载实例列表
 *
 * @param request ListPluginsInstancesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPluginsInstancesResponse
 */
async function listPluginsInstancesWithOptions(request: ListPluginsInstancesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPluginsInstancesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.instanceIdName)) {
    query['instance_id_name'] = request.instanceIdName;
  }
  if (!Util.isUnset(request.instanceTag)) {
    query['instance_tag'] = request.instanceTag;
  }
  if (!Util.isUnset(request.operationType)) {
    query['operation_type'] = request.operationType;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.pluginId)) {
    query['plugin_id'] = request.pluginId;
  }
  if (!Util.isUnset(request.region)) {
    query['region'] = request.region;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPluginsInstances',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/listPluginsInstances`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取插件的安装/更新/卸载实例列表
 *
 * @param request ListPluginsInstancesRequest
 * @return ListPluginsInstancesResponse
 */
async function listPluginsInstances(request: ListPluginsInstancesRequest): ListPluginsInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPluginsInstancesWithOptions(request, headers, runtime);
}

model ListPodsOfInstanceRequest {
  clusterId?: string(name='cluster_id', example='c96e34d74eb6748f3b2a46552d5d653f6'),
  current?: long(name='current', example='1'),
  instance?: string(name='instance', example='i-wz9d00ut2ska3mlyhn6j'),
  pageSize?: long(name='pageSize', example='10'),
}

model ListPodsOfInstanceResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request', example='B149FD9C-ED5C-5765-B3AD-05AA4A4D64D7'),
  code?: string(name='code', example='Success'),
  data?: [ 
    {
      namespace?: string(name='namespace', example='default'),
      pod?: string(name='pod', example='test-pod'),
    }
  ](name='data'),
  message?: string(name='message', description='This parameter is required.', example='instance not exists'),
  total?: long(name='total', example='42'),
}

model ListPodsOfInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListPodsOfInstanceResponseBody(name='body'),
}

/**
 * @summary 获取实例中的pod列表
 *
 * @param request ListPodsOfInstanceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPodsOfInstanceResponse
 */
async function listPodsOfInstanceWithOptions(request: ListPodsOfInstanceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPodsOfInstanceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clusterId)) {
    query['cluster_id'] = request.clusterId;
  }
  if (!Util.isUnset(request.current)) {
    query['current'] = request.current;
  }
  if (!Util.isUnset(request.instance)) {
    query['instance'] = request.instance;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['pageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPodsOfInstance',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/instance/list_pod_of_instance`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取实例中的pod列表
 *
 * @param request ListPodsOfInstanceRequest
 * @return ListPodsOfInstanceResponse
 */
async function listPodsOfInstance(request: ListPodsOfInstanceRequest): ListPodsOfInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listPodsOfInstanceWithOptions(request, headers, runtime);
}

model ListRegionsResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: [ string ](name='data', example='["cn-hangzhou", "cn-shengzhen"]'),
  message?: string(name='message', example='SysomOpenAPIAssumeRoleException: EntityNotExist.Role The role not exists: acs:ram::xxxxx:role/aliyunserviceroleforsysom'),
}

model ListRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRegionsResponseBody(name='body'),
}

/**
 * @summary 列出所有纳管了机器的区域
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRegionsResponse
 */
async function listRegionsWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): ListRegionsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListRegions',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/instance/list_regions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 列出所有纳管了机器的区域
 *
 * @return ListRegionsResponse
 */
async function listRegions(): ListRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRegionsWithOptions(headers, runtime);
}

model StartAIAnalysisRequest {
  analysisTool?: string(name='analysisTool'),
  channel?: string(name='channel', example='ecs_sysom'),
  comms?: string(name='comms', example='python_test'),
  instance?: string(name='instance', example='i-wz9dej066kii4goqxxxx'),
  pids?: string(name='pids', example='2421,36547,10043'),
  region?: string(name='region', example='cn-shenzhen'),
  timeout?: int32(name='timeout', example='2000'),
}

model StartAIAnalysisResponseBody = {
  code?: string(name='code', example='Success'),
  data?: {
    analysisId?: string(name='analysis_id', example='16896fa8-37f6-4c70-bb32-67fa9817d426'),
  }(name='data'),
  message?: string(name='message', example='""'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model StartAIAnalysisResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartAIAnalysisResponseBody(name='body'),
}

/**
 * @summary 启动AI作业分析
 *
 * @param request StartAIAnalysisRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartAIAnalysisResponse
 */
async function startAIAnalysisWithOptions(request: StartAIAnalysisRequest, headers: map[string]string, runtime: Util.RuntimeOptions): StartAIAnalysisResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.analysisTool)) {
    body['analysisTool'] = request.analysisTool;
  }
  if (!Util.isUnset(request.channel)) {
    body['channel'] = request.channel;
  }
  if (!Util.isUnset(request.comms)) {
    body['comms'] = request.comms;
  }
  if (!Util.isUnset(request.instance)) {
    body['instance'] = request.instance;
  }
  if (!Util.isUnset(request.pids)) {
    body['pids'] = request.pids;
  }
  if (!Util.isUnset(request.region)) {
    body['region'] = request.region;
  }
  if (!Util.isUnset(request.timeout)) {
    body['timeout'] = request.timeout;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StartAIAnalysis',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/proxy/post/start_ai_analysis`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 启动AI作业分析
 *
 * @param request StartAIAnalysisRequest
 * @return StartAIAnalysisResponse
 */
async function startAIAnalysis(request: StartAIAnalysisRequest): StartAIAnalysisResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return startAIAnalysisWithOptions(request, headers, runtime);
}

model UninstallAgentRequest {
  agentId?: string(name='agent_id', description='This parameter is required.'),
  agentVersion?: string(name='agent_version', description='This parameter is required.'),
  instances?: [ 
    {
      instance?: string(name='instance', description='This parameter is required.', example='i-wz9b9vucz1iubsz8sjqo'),
      region?: string(name='region', description='This parameter is required.', example='cn-hangzhou'),
    }
  ](name='instances', description='This parameter is required.'),
}

model UninstallAgentResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: {
    taskId?: string(name='task_id'),
  }(name='data'),
  message?: string(name='message', example='SysomOpenAPIAssumeRoleException: EntityNotExist.Role The role not exists: acs:ram::xxxxx:role/aliyunserviceroleforsysom'),
}

model UninstallAgentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UninstallAgentResponseBody(name='body'),
}

/**
 * @summary 卸载 SysOM Agent
 *
 * @param request UninstallAgentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UninstallAgentResponse
 */
async function uninstallAgentWithOptions(request: UninstallAgentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UninstallAgentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.agentId)) {
    body['agent_id'] = request.agentId;
  }
  if (!Util.isUnset(request.agentVersion)) {
    body['agent_version'] = request.agentVersion;
  }
  if (!Util.isUnset(request.instances)) {
    body['instances'] = request.instances;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UninstallAgent',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/uninstall_agent`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 卸载 SysOM Agent
 *
 * @param request UninstallAgentRequest
 * @return UninstallAgentResponse
 */
async function uninstallAgent(request: UninstallAgentRequest): UninstallAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return uninstallAgentWithOptions(request, headers, runtime);
}

model UninstallAgentForClusterRequest {
  agentId?: string(name='agent_id', example='74a86327-3170-412c-8e67-da3389ec56a9'),
  agentVersion?: string(name='agent_version', example='3.4.0-1'),
  clusterId?: string(name='cluster_id', example='c822f83bb45994ddbac9326b4c2f04f35'),
}

model UninstallAgentForClusterResponseBody = {
  requestId?: string(name='RequestId', example='44841312-7227-55C9-AE03-D59729BFAE38'),
  code?: string(name='code', example='Success'),
  data?: {
    taskId?: string(name='task_id', example='049ea0609515414b9e19c3389d7ba638'),
  }(name='data'),
  message?: string(name='message', example='SysomOpenAPIException: SysomOpenAPI.NotAuthorizedInstance Instance 21 is not authorized'),
}

model UninstallAgentForClusterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UninstallAgentForClusterResponseBody(name='body'),
}

/**
 * @summary 给集群卸载组件
 *
 * @param request UninstallAgentForClusterRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UninstallAgentForClusterResponse
 */
async function uninstallAgentForClusterWithOptions(request: UninstallAgentForClusterRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UninstallAgentForClusterResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.agentId)) {
    body['agent_id'] = request.agentId;
  }
  if (!Util.isUnset(request.agentVersion)) {
    body['agent_version'] = request.agentVersion;
  }
  if (!Util.isUnset(request.clusterId)) {
    body['cluster_id'] = request.clusterId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UninstallAgentForCluster',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/uninstall_agent_by_cluster`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 给集群卸载组件
 *
 * @param request UninstallAgentForClusterRequest
 * @return UninstallAgentForClusterResponse
 */
async function uninstallAgentForCluster(request: UninstallAgentForClusterRequest): UninstallAgentForClusterResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return uninstallAgentForClusterWithOptions(request, headers, runtime);
}

model UpdateEventsAttentionRequest {
  body?: {
    mode?: int32(name='mode', example='0'),
    range?: string(name='range', example='cluster'),
    uuid?: string(name='uuid', description='This parameter is required.', example='03de78af-f49f-433d-b5b1-0f6a70c493ba'),
  }(name='body'),
}

model UpdateEventsAttentionShrinkRequest {
  bodyShrink?: string(name='body'),
}

model UpdateEventsAttentionResponseBody = {
  requestId?: string(name='RequestId', example='44841312-7227-55C9-AE03-D59729BFAE38'),
  code?: string(name='code', example='Success'),
  data?: {
    mode?: int32(name='mode', example='1'),
  }(name='data'),
  message?: string(name='message', example='Instance not belong to current user'),
}

model UpdateEventsAttentionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateEventsAttentionResponseBody(name='body'),
}

/**
 * @summary 异常项关注度更新
 *
 * @param tmpReq UpdateEventsAttentionRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateEventsAttentionResponse
 */
async function updateEventsAttentionWithOptions(tmpReq: UpdateEventsAttentionRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateEventsAttentionResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateEventsAttentionShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.body)) {
    request.bodyShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.body, 'body', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.bodyShrink)) {
    query['body'] = request.bodyShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateEventsAttention',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/openapi/proxy/post/cluster_update_events_attention`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 异常项关注度更新
 *
 * @param request UpdateEventsAttentionRequest
 * @return UpdateEventsAttentionResponse
 */
async function updateEventsAttention(request: UpdateEventsAttentionRequest): UpdateEventsAttentionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateEventsAttentionWithOptions(request, headers, runtime);
}

model UpdateFuncSwitchRecordRequest {
  channel?: string(name='channel', description='This parameter is required.', example='ecs'),
  params?: {
    args?: {
      addCmd?: string(name='add_cmd', example='java'),
      cpu?: string(name='cpu', example='true'),
      javaStorePath?: string(name='java_store_path', example='/tmp/sysom/java-profiler'),
      locks?: string(name='locks', example='true'),
      loop?: int32(name='loop', example='-1'),
      mem?: string(name='mem', example='true'),
      systemProfiling?: string(name='system_profiling', example='true'),
    }(name='args'),
    functionName?: string(name='function_name', description='This parameter is required.', example='mullprof'),
    instance?: string(name='instance', example='i-2zei55fwj8nnu31h3z46'),
    op?: string(name='op', example='restart'),
    uid?: string(name='uid', example='1664516888213680'),
  }(name='params', description='This parameter is required.'),
  serviceName?: string(name='service_name', description='This parameter is required.', example='livetrace'),
}

model UpdateFuncSwitchRecordShrinkRequest {
  channel?: string(name='channel', description='This parameter is required.', example='ecs'),
  paramsShrink?: string(name='params', description='This parameter is required.'),
  serviceName?: string(name='service_name', description='This parameter is required.', example='livetrace'),
}

model UpdateFuncSwitchRecordResponseBody = {
  code?: string(name='code', example='Success'),
  data?: {
    taskId?: string(name='task_id', example='63fc5acb99e642d793f42912612e8001'),
  }(name='data'),
  message?: string(name='message', example='result: code=1 msg=(Request failed, status_code != 200)'),
  requestId?: string(name='requestId', description='Id of the request', example='2D693121-C925-5154-8DF6-C09A8B369822'),
}

model UpdateFuncSwitchRecordResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateFuncSwitchRecordResponseBody(name='body'),
}

/**
 * @summary 获取功能模块配置
 *
 * @param tmpReq UpdateFuncSwitchRecordRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateFuncSwitchRecordResponse
 */
async function updateFuncSwitchRecordWithOptions(tmpReq: UpdateFuncSwitchRecordRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateFuncSwitchRecordResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateFuncSwitchRecordShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.params)) {
    request.paramsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.params, 'params', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.channel)) {
    query['channel'] = request.channel;
  }
  if (!Util.isUnset(request.paramsShrink)) {
    query['params'] = request.paramsShrink;
  }
  if (!Util.isUnset(request.serviceName)) {
    query['service_name'] = request.serviceName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateFuncSwitchRecord',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/func-switch/update-service-func-switch`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 获取功能模块配置
 *
 * @param request UpdateFuncSwitchRecordRequest
 * @return UpdateFuncSwitchRecordResponse
 */
async function updateFuncSwitchRecord(request: UpdateFuncSwitchRecordRequest): UpdateFuncSwitchRecordResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateFuncSwitchRecordWithOptions(request, headers, runtime);
}

model UpgradeAgentRequest {
  agentId?: string(name='agent_id', description='This parameter is required.'),
  agentVersion?: string(name='agent_version', description='This parameter is required.'),
  instances?: [ 
    {
      instance?: string(name='instance', description='This parameter is required.', example='i-wz9b9vucz1iubsz8sjqo'),
      region?: string(name='region', description='This parameter is required.', example='cn-hangzhou'),
    }
  ](name='instances', description='This parameter is required.'),
}

model UpgradeAgentResponseBody = {
  requestId?: string(name='RequestId'),
  code?: string(name='code', example='Success'),
  data?: {
    taskId?: string(name='task_id'),
  }(name='data'),
  message?: string(name='message', example='SysomOpenAPIException: SysomOpenAPI.InvalidParameter Invalid params, should be json string or dict'),
}

model UpgradeAgentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeAgentResponseBody(name='body'),
}

/**
 * @summary 更新 SysOM Agent
 *
 * @param request UpgradeAgentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeAgentResponse
 */
async function upgradeAgentWithOptions(request: UpgradeAgentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpgradeAgentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.agentId)) {
    body['agent_id'] = request.agentId;
  }
  if (!Util.isUnset(request.agentVersion)) {
    body['agent_version'] = request.agentVersion;
  }
  if (!Util.isUnset(request.instances)) {
    body['instances'] = request.instances;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeAgent',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/upgrade_agent`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 更新 SysOM Agent
 *
 * @param request UpgradeAgentRequest
 * @return UpgradeAgentResponse
 */
async function upgradeAgent(request: UpgradeAgentRequest): UpgradeAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return upgradeAgentWithOptions(request, headers, runtime);
}

model UpgradeAgentForClusterRequest {
  agentId?: string(name='agent_id', example='74a86327-3170-412c-8e67-da3389ec56a9'),
  agentVersion?: string(name='agent_version', example='3.4.0-1'),
  clusterId?: string(name='cluster_id', example='c1c187fd513cb41a19876bac0e6b05212'),
}

model UpgradeAgentForClusterResponseBody = {
  requestId?: string(name='RequestId', example='B149FD9C-ED5C-5765-B3AD-05AA4A4D64D7'),
  code?: string(name='code', example='Success'),
  data?: {
    taskId?: string(name='task_id', example='7523e9e0ddc74d99a5236f4f4d5056e6'),
  }(name='data'),
  message?: string(name='message', example='success'),
}

model UpgradeAgentForClusterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeAgentForClusterResponseBody(name='body'),
}

/**
 * @summary 给集群更新组件
 *
 * @param request UpgradeAgentForClusterRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeAgentForClusterResponse
 */
async function upgradeAgentForClusterWithOptions(request: UpgradeAgentForClusterRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpgradeAgentForClusterResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.agentId)) {
    body['agent_id'] = request.agentId;
  }
  if (!Util.isUnset(request.agentVersion)) {
    body['agent_version'] = request.agentVersion;
  }
  if (!Util.isUnset(request.clusterId)) {
    body['cluster_id'] = request.clusterId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeAgentForCluster',
    version = '2023-12-30',
    protocol = 'HTTPS',
    pathname = `/api/v1/am/agent/upgrade_agent_by_cluster`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary 给集群更新组件
 *
 * @param request UpgradeAgentForClusterRequest
 * @return UpgradeAgentForClusterResponse
 */
async function upgradeAgentForCluster(request: UpgradeAgentForClusterRequest): UpgradeAgentForClusterResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return upgradeAgentForClusterWithOptions(request, headers, runtime);
}

